<template>
	<view>
		<web-view :src="url" class="web"></web-view>
	</view>
</template>
<script setup>
	import {
		ref,
		computed
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		CONFIG
	} from '../../utils/config';
	import {
		userStore
	} from '../../store/userStore';
	import {
		getMapDistance
	} from "@/utils/tools.js"
	let store = userStore([])
	let url = ref("")
	onLoad((data) => {
		let type = data.type
		console.log((type))
		if (type == 1) {
			url.value = `https://m.amap.com/navi/?dest=${store.currentPos.longitude},${store.currentPos.latitude}&destName=我的位置&hideRouteIcon=1&key=
		${6d488d684985d656a9b3c9397c8472ec}&jscode=${15161047bfa7ccd94f85707822daa783}`
			uni.setNavigationBarTitle({
				title: "我的位置",
			})
		} else if (type == 2) {
			let lat = data.lat
			let lon = data.lon
			url.value = `https://m.amap.com/navi/?start=${store.currentPos.longitude},${store.currentPos.latitude}&dest=${lon},${lat}&destName=${data.name}&key=${6d488d684985d656a9b3c9397c8472ec}
		&jscode=${15161047bfa7ccd94f85707822daa783}`
			uni.setNavigationBarTitle({
				title: "到" + data.name "的路径",

			})
		}

	})
</script>
<style>

</style>